package com.example.zhugenew.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.zhugenew.R;
import com.example.zhugenew.bean.MarketBean;

public class ZhuGeHangQingAdapter extends RecyclerView.Adapter{
    // List<ZhuGHQBean.ListBean> list;
    private MarketBean.ListBean listBean;
    private Context context;

    public ZhuGeHangQingAdapter(MarketBean.ListBean listBean, Context context) {
        this.listBean = listBean;
        this.context = context;
    }

    //    public void additem(ZhuGHQBean.ListBean listBean){
//        this.
//
//    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.layout_market_item, null);

        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        ViewHolder holder1= (ViewHolder) holder;






        holder1.mPrice.setText(this.listBean.getSell_city_price_average()+"");
        holder1.mShuliang.setText(this.listBean.getHouse_rise_count()+"");
        holder1.mTao.setText(this.listBean.getHouse_drop_count()+"");
        holder1.mErshou.setText(this.listBean.getSell_city_price_title());
        holder1.mBaifenzhi.setText(this.listBean.getSell_city_price_percentage()+"%");
        holder1.mXinshang.setText(this.listBean.getHouse_rise_title());
        holder1.mJiangjia.setText(this.listBean.getHouse_drop_title());
        holder1.mHuanbishangyue.setText("("+this.listBean.getSell_city_price_description()+")");
//        switch (position){
//            case 0:
//                holder1.mPrice.setText(listBean.getSell_city_price_average()+"元/㎡");
//                holder1.mText.setText(listBean.getSell_city_price_title()+listBean.getSell_city_price_percentage()+"("+listBean.getSell_city_price_description()+")");
//                break;
//            case 1:
//                holder1.mPrice.setText("约"+listBean.getHouse_rise_count()+"套");
//                holder1.mText.setText(listBean.getHouse_rise_title());
//                break;
//            case 2:
//                holder1.mPrice.setText("约"+listBean.getHouse_drop_count()+"套");
//                holder1.mText.setText(listBean.getHouse_drop_title());
//                break;
//
//        }
    }

//    @Override
//    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
////        ViewHolder holder1=(ViewHolder) holder;
////       // ZhuGHQBean.ListBean listBean = list.get(position);
////        holder1.mPrice.setText(this.listBean.getSell_city_price_average());
////        holder1.mShuliang.setText(this.listBean.getHouse_rise_count());
////        holder1.mTao.setText(this.listBean.getHouse_drop_count());
////        holder1.mErshou.setText(this.listBean.getSell_city_price_title());
////        holder1.mBaifenzhi.setText(this.listBean.getSell_city_price_percentage()+"%");
////        holder1.mXinshang.setText(this.listBean.getHouse_rise_title());
////        holder1.mJiangjia.setText(this.listBean.getHouse_drop_title());
//
//
//
//
//    }

    @Override
    public int getItemCount() {
        return 1;
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
//        TextView mPrice;
//        TextView mText;



        TextView mZhugehangqing;
        TextView mPrice;
        TextView mLookmanny;
        TextView mShuliang;
        TextView mTao;
        TextView mErshou;
        TextView mJian;
        TextView mBaifenzhi;
        TextView mXinshang;
        TextView mJiangjia;
        TextView mHuanbishangyue;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            this.mZhugehangqing = itemView.findViewById(R.id.zhugehangqing);
            this.mPrice = itemView.findViewById(R.id.price);
            this.mLookmanny = itemView.findViewById(R.id.Lookmanny);
            this.mShuliang = itemView.findViewById(R.id.shuliang);
            this.mTao = itemView.findViewById(R.id.tao);
            this.mErshou = itemView.findViewById(R.id.ershou);
            this.mJian = itemView.findViewById(R.id.jian);
            this.mBaifenzhi = itemView.findViewById(R.id.baifenzhi);
            this.mXinshang = itemView.findViewById(R.id.xinshang);
            this.mJiangjia = itemView.findViewById(R.id.jiangjia);
            this.mHuanbishangyue = itemView.findViewById(R.id.huanbishangyue);


//            this.mText = itemView.findViewById(R.id.text);
//            this.mPrice = itemView.findViewById(R.id.price1);

        }
    }
}
